<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>编辑图书</title>
</head>
<head th:replace="fragments/header :: head"></head>
<body>
<div th:replace="fragments/header :: navbar"></div>
<div class="container pt-5">
    <div class="row justify-content-center">
        <div class="col-6">
            <div class="alert alert-success" th:if="${successMessage}" th:utext="${successMessage}">
            </div>
            <form name="bookForm" role="form" method="post" th:object="${bookForm}"th:action="@{/books/edit}"
                  enctype="multipart/form-data">
                <h3 class="text-center">编辑图书信息</h3>
                <div class="form-group">
                    <label for="id">ID</label>
                    <input type="text" class="form-control" id="id" name="id" th:field="*{bookId}"readonly/>
                </div>
                <div class="form-group">
                    <label class="form-control-label" for="field_bookTitle">图书名称</label>
                        <input type="text" class="form-control" name="bookName" id=
                                "field_bookTitle" required th:field="*{bookName}"/>
                </div>
                <div class="form-group">
                    <label class="form-control-label" for="field_bookAuthor">图书作者</label>
                    <input type="text" class="form-control" name="bookAuthor" id=
                    "field_bookAuthor" required th:field="*{bookAuthor}"/>
                </div>
                <div class="form-group">
                    <label class="form-control-label" for="field_bookPublisher">出版社
                    </label>
                    <input type="text" class="form-control"id="field_bookPublisher" required
                    name="bookPublisher" th:field="*{bookPublisher}"/>
                </div>
                <div class="form-group">
                    <label class="form-control-label" for="field_bookIsbn">图书ISBN</label>
                    <input type="text" class="form-control" name="bookIsbn"
                           id="field_bookIsbn" required th:field="*{bookIsbn}"/>
                </div>
                <div class="form-group">
                    <label class="form-control-label" for="field_bookPrice">图书价格</label>
                    <input type="number" step="0.1" class="form-control" name="bookPrice"
                           id="field_bookPrice" required th:field="*{bookPrice}"/>
                </div>
                <div class="form-group">
                    <label class="form-control-label" for="field_bookDescription">图书简介</label>
                    <textarea class="form-control" name="bookDescription"
                              id="field_bookDescription" required th:field="*{bookDescription}">
                    </textarea>
                </div>
                <div class="form-group">
                    <label class="form-control-label" for="field_bookImage">图书缩略图</label>
                    <div id="field_bookImage">
                        <img height="100px" th:src="@{|/bookImage?bookId=${bookForm.bookId}|}" />
                    </div>
                </div>
                <div class="col-12 text-end">
                    <a type="button" class="btn btn-secondary" th:href="@{/books}">返回</a>
                    <button type="submit" class="btn btn-primary">提交</button>
                </div>
            </form>
        </div>
    </div>
</div>
</body>
</html>